package kt.com.bilin.coin.ui.fragment.mill

import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.bilin.coin.R
import kotlinx.android.synthetic.main.fragment_my_mill_manage.*
import kt.com.bilin.coin.common.tabData
import kt.com.bilin.coin.listener.OnTabSelectedListener
import kt.com.bilin.coin.ui.fragment.BaseFragment
import kt.com.bilin.coin.utils.FragmentChangeManager
import java.util.ArrayList

class MyMillManageFragment : BaseFragment(R.layout.fragment_my_mill_manage) {
    private var mFragmentChangeManager: FragmentChangeManager? = null
    override fun initView(rootView: View?, savedInstanceState: Bundle?) {
        tabLayout.tabData {
            tab { "使用中" }
            tab { "已过期" }
        }
        tabLayout.addOnTabSelectedListener(OnTabSelectedListener { mFragmentChangeManager?.setFragments(tabLayout.selectedTabPosition) })
        val fragments = ArrayList<Fragment>()
        fragments.add(MyMillFragment.createInstance(0))
        fragments.add(MyMillFragment.createInstance(1))
        mFragmentChangeManager = FragmentChangeManager(childFragmentManager, R.id.frameLayout, fragments)
    }
}